from multiprocessing import Process

import os
from time import sleep


def printInfo():
    print('进程号：',os.getpid())
    i = 0
    while True:
        print('my name is 子进程')
        i += 1
        if i >10:
            break
        sleep(0.1)

if __name__ == '__main__':
    #通过指定目标函数创建进程对象
    p1 = Process(target=printInfo)
    p1.start()

    print('主进程号：', os.getpid())
    i = 0
    while True:
        print('我是一个主进程')
        i +=1
        if i > 5:
            break
        sleep(0.1)